package org.dam.service;

import org.dam.common.page.PageResponse;
import org.dam.entity.BackupFile;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dam.entity.request.BackupFileRequest;

import java.util.List;

/**
 * @author mac
 * @description 针对表【backup_file】的数据库操作Service
 * @createDate 2024-01-19 11:05:11
 */
public interface BackupFileService extends IService<BackupFile> {

    /**
     * 常规分页查询：数据量大，效率非常低
     * @param pageRequest
     * @param isOrder
     * @return
     */
    PageResponse<BackupFile> pageBackupFileV1(BackupFileRequest pageRequest, boolean isOrder);

    /**
     * 使用缓存加快total查询，分页深度的时候，效率还是低
     * @param pageRequest
     * @param isOrder
     * @return
     */
    PageResponse<BackupFile> pageBackupFileV2(BackupFileRequest pageRequest, boolean isOrder);

    /**
     * 使用缓存加快total查询;
     * 分页查询使用子查询
     * @param pageRequest
     * @param isOrder
     * @return
     */
    PageResponse<BackupFile> pageBackupFileV3(BackupFileRequest pageRequest, boolean isOrder);

    void updateTotalCache();

    void updateBackupNum(long fileId);

    List<BackupFile> buildTree(Long sourceId);

    void recursionRemoveBackupFile(List<Long> removeFileMessageIdList);

    List<BackupFile> listChildrenBySourceIdAndFatherId(Long sourceId, Long fatherId);

    void unCompress(Long fileMessageId);

    byte[] downloadUnCompressFile(BackupFile fileMessage);

    void updateBatchByIdAndSourceId(List<BackupFile> list);
}
